import json
from src.common.logger import getLogger
from flask import Blueprint, Response, request
from src.modules.modal.service import chat_service

logger = getLogger()
api = Blueprint('chat', __name__)

@api.route('/llm/chat', methods=['GET'])
def chat():
    logger.info("----- chat request prompt -----")
    args = request.args
    response = chat_service.generate_response(args)
    data = { "code": 200, "data": response, "message": None }
    return Response(json.dumps(data), status = 200, mimetype = "application/json")
